package com.yu.thread4;

import java.util.concurrent.TimeUnit;

/**
 * Created by xiaolongyu on 15/1/23.
 */
public class IncreaseThread extends Thread {

    private Sample sample;

    public IncreaseThread(Sample sample){
        this.sample = sample;
    }

    @Override
    public void run() {
        for(int i = 0; i < 20; i ++){
            try {
                TimeUnit.SECONDS.sleep(1);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            sample.increase();
        }
    }
}
